package google.entry;

import google.entry.worker.Worker;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by zhongwei on 2016/12/24.
 */
public class Google {

    public static void main(String[] args) throws IOException, URISyntaxException {
        int start = Integer.parseInt(args[0]);
        int end = Integer.parseInt(args[1]);
        List<File> tasks = new ArrayList<>();
        List<File> outputs = new ArrayList<>();
        for (int i = 1; i <= 30; i++) {
            tasks.add(new File("company/company_list_" + i));
            outputs.add(new File("output_" + i));
        }
        int shift = end - start + 1;
        List<String> hosts = Arrays.asList("http://www.acgn.ren/search?q=", "http://www.acgn.ren/search?q=", "http://www.acgn.ren/search?q=", "https://cc.zzyjxs.com/search?q=", "https://cc.zzyjxs.com/search?q=", "https://cc.zzyjxs.com/search?q=");
        for (int i = 0; i < shift; i++) {
            for (int j = 0; j < 6; j++) {
                Worker worker = new Worker(args, tasks.get(i + 1), outputs.get(i + 1), hosts.get(j));
                worker.start();
            }
        }
    }
}
